import httpUtil from "../utils/httpUtil"

const currentVerify = 3

/**
 * 审核版本控制
 */
const isVerify = (successCallBack) => {
	let params = {
		pid: 1,
		ver: currentVerify
	}
	httpUtil.post('/api/Alipayad/shenhe', params, res => {
		if (successCallBack) {
			successCallBack(res.data.is == 1)
		}
	})
}

const is404 = () => {
	let params = {
		a: httpUtil.getA()
	}
	httpUtil.postReturnSource('/api/Alipayad/status', params, res => {
		// res.code = -404
		if (res.code == -404) {
			uni.redirectTo({
				url: '/pages/404/404'
			})
		}
		// console.log('is404', res, res.code)
	})
}


/**
 * 埋点请求
 */
const buriedPoint = (env) => {
	let params = {
		a: httpUtil.getA(),
		env,
	}

	httpUtil.postReturnSource('/api/rf/getMpUrl', params)
}



export default {
	isVerify,
	is404,
	buriedPoint,
}